package merge_sort;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;

public class main {

	public static void main(String[] args) {
		quick q = new quick();
		long time_start = 0;
		int max = 500000;
		System.out.printf("Merge\n");
		for (int n = 100000; n <= max; n=n+50000){
			int[] array = new int[n];
			Random r = new Random();
			for (int i = 0; i<n; i++)
			{
				array[i]=Math.abs(r.nextInt(10000));
			}
			time_start = System.currentTimeMillis();
			merge.Merge_Sort(array);
			System.out.printf("merge n = "+ n + " Time is " + (System.currentTimeMillis() - time_start)+ "\n");
		}
		System.out.printf("Quick\n");
		for (int n = 100000; n <= max; n=n+50000){
			int[] array = new int[n];
			Random r = new Random();
			for (int i = 0; i<n; i++)
			{
				array[i]=Math.abs(r.nextInt(10000));
			}
			time_start = System.currentTimeMillis();
			q.Quick_sort(array, 0, n-1);
			System.out.printf("quick n = "+ n + " Time is " + (System.currentTimeMillis() - time_start)+ "\n");
		}
	}
}
